package com.conote.mess;

import java.io.File;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.DayOfWeek;

public class BuildToday {

    public void createFolderWithDate(String directoryPath) {
        LocalDate currentDate = LocalDate.now();
        DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
        String datePart = currentDate.format(dateFormatter);
        DayOfWeek dayOfWeek = currentDate.getDayOfWeek();
        String dayPart = String.valueOf(dayOfWeek.getValue());
        String folderName = datePart + "-" + dayPart;
        File folder = new File(directoryPath, folderName);

        if (!folder.exists()) {
            boolean created = folder.mkdir();
            if (created) {
                System.out.println("Folder created: " + folder.getAbsolutePath());
            } else {
                System.out.println("Failed to create folder: " + folder.getAbsolutePath());
            }
        } else {
            System.out.println("Folder already exists: " + folder.getAbsolutePath());
        }
    }

    public static void main(String[] args) {
        BuildToday buildToday = new BuildToday();
        buildToday.createFolderWithDate("C:\\Users\\kofi\\Desktop\\aaa");
    }
}
